// component/userInfo/userinfo.js
import {getTime} from '../../utils/message'
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    userData:{
      type:Object,
      value:{},
      observer:function(newval){
        // console.log(newval);
      }
    },
    Time:{
      type:String,
      value:'',
      observer:function(newval){
        if (JSON.stringify(newval) !== '{}') {
          this.setData({
            timeMsg:getTime(newval)
          })
        }
      }
    },
    Msg:{
      type:String,
      value:''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    timeMsg:{},
    isLiked:true
  },

  /**
   * 组件的方法列表
   */
  methods: {
    likes(){
      this.setData({
        isLiked:!this.data.isLiked
      })
    },
    goTalking(){
      wx.navigateTo({
        url:`../../pages/talking/talking?id=${this.properties.userData.userId}`,
      })
    }
  }
})
